import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);
const routes = [
  {
    path: '/',
    redirect: '/menus'
  },
  {
    path: '/menus',
    component: () => import('../menus/menus.vue')
  },
  {
    path: '/vueRouterTest/:id',
    beforeEnter: (to, from, next) => {
      next();
    },
    components: {
      default() { return import('./vueRouterTest.vue'); },
      namedView() { return import('./namedView.vue'); }
    },
    children: [
      {
        path: 'childRouter/:id',
        props: true,
        component: () => import('./childRouter.vue')
      }
    ]
  },
  {
    path: '/vueVuexTest',
    component: () => import('./vueVuexTest.vue')
  }
];

export default new Router({
  mode: 'history',
  routes
});
